package com.itheima.mapper;

import com.itheima.entity.QueryPageBean;
import com.itheima.pojo.CheckItem;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface CheckItemMapper {

    //新增检查项
    void add(CheckItem checkItem);

    //检查项分页查询
    List<CheckItem> findPage(@Param("queryString") String queryString);

    //根据id删除检查项
    @Update("update t_checkitem set is_delete=1 where id=#{id}")
    void deleteCheckItemById(Integer id);

    //编辑检查项
    void edit(CheckItem checkItem);

    //在检查组中查询所有检查项
    @Select("select * from t_checkitem")
    List<CheckItem> findAll();


    //根据检查组id获取对应检查项的数据
    @Select("select* from t_checkitem where id in(select checkitem_id from t_checkgroup_checkitem where checkgroup_id=#{id}) and IS_DELETE=0")
    List<CheckItem> findCheckItemByCheckGroupId(Integer id);
}
